package com.xiaomi.service.Impl;

import com.xiaomi.dao.AddressDao;
import com.xiaomi.pojo.Address;
import com.xiaomi.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName AddressServiceImpl
 * @Author xiao宋
 * @Date 20:32  2022/9/15
 * @Version 1.0
 * @Description TODO
 */
@Service
public class AddressServiceImpl implements AddressService {
    @Autowired
    AddressDao addressDao;
    @Override
    public List<Address> getAddrList(int uid) {
        return addressDao.getAddList(uid);
    }

    @Override
    public void addAddress(Address address) {
        addressDao.addAddress(address);
    }

    @Override
    public void updateAddress(Address address) {
        addressDao.updateAddress(address);
    }

    @Override
    public void setDefaultAddress(int uid, String aId) {
        addressDao.set2normal(uid);
        addressDao.setDefaultAddress(aId);
    }

    @Override
    public void deleteAddress(int id) {
        addressDao.deleteAddress(id);
    }
}
